/**********************************************
 * 
 * File Name				:	EmailHelperTest.java
 * 
 * Last Changed Date		: 	$Date: 2009-08-01 11:12:53 +0800 (星期六, 01 八月 2009) $
 * 
 * Last Changed Revision	:	$Revision: 86 $
 * 
 * Last Changed Author		:	$Author: cfanboy $
 * 
 * File Header URL			:	$HeadURL: svn://www.svnhost.cn/Busi-Building/code/branch/src/com/busibuilding/testcase/EmailHelperTest.java $
 * 
 * ********************************************
 */

package com.busibuilding.testcase;

import org.springframework.test.AbstractDependencyInjectionSpringContextTests;

import com.busibuilding.common.email.EmailHelper;
import com.busibuilding.common.vo.EmailVO;
import com.busibuilding.utils.DateUtils;

/**
 * Class Name: EmailHelperTest.java
 * Description: 
 * @author YU Zhipeng
 * @version 1.0
 * @since 1.0
 * Date: 2009-7-15
 */

public class EmailHelperTest extends AbstractDependencyInjectionSpringContextTests{
	private EmailHelper helper;

	public void setHelper(EmailHelper helper) {
		this.helper = helper;
	}
	
	protected String[] getConfigLocations(){
		return new String[]{"classpath:config/spring-config/ApplicationContext-Common.xml",
				"classpath:config/spring-config/ApplicationContext-Admin.xml",
				"classpath:config/spring-config/ApplicationContext-WebAction.xml"};
	}
	
	public void testSendAsyncMail(){
		EmailVO vo = new EmailVO();
		vo.setFrom("guoli.china@163.com");
		vo.setTo("cfanboy@163.com");
		vo.setSubject("Testing email async");
		vo.setPlainTextConent("Testing email send async");
		vo.setSendDate(DateUtils.getCurrentDate().toString());
		
		try {
			helper.sendAsyncMail(vo, false);
			Thread.sleep(15000);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
